package com.sc.show.feign;

import com.sc.show.entity.WeatherResponse;
import com.sc.show.hytrix.WeatherDataFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author shuchang
 * @Date 2018/3/19 下午2:30
 *
 * 这里通过访问网关来访问服务
 *
 * 实现类是hytrix断路器的方法
 */
@FeignClient(name = "zuul-service",fallback = WeatherDataFallBack.class)
@Component
public interface WeatherDataFeign {

    @GetMapping("/data/weather/cityId/{cityId}")
    WeatherResponse getById(@PathVariable("cityId") String cityId);


    @GetMapping("/data/weather/cityName/{cityName}")
    WeatherResponse getByName(@PathVariable("cityName") String cityName);
}
